﻿using Client.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Client.EditDialog
{
    /// <summary>
    /// EquipmentLeaseView.xaml 的交互逻辑
    /// </summary>
    public partial class DialogWindow: Window 
    {
        public UserControl? View { get; set; }
        public object cBM_ { get; set; }
        /// <summary>
        /// 返回参数提供回调
        /// </summary>
        private Action<object> action { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DialogWindow(object cBM_, Action<object> action, UserControl view)
        {
            InitializeComponent();
            this.action= action;
            this.cBM_ = cBM_;
            View = view;
            View.DataContext = cBM_;
           
        }
        //取消
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
        //确认
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            this.Close();
            action?.Invoke(cBM_);
        }
    }
}
